﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class 显示页面所有控件 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        Response.Write(GetPageControlsCount());



    }

    ///   <summary> 
    ///   得到页面控件集合字符串 
    ///   </summary> 
    ///   <returns> 返回页面控件名字符串 </returns> 
    public string GetPageControlsCount()
    {
        string formContorls = " ";
        int len = Form.Controls.Count;
        for (int i = 0; i < len; i++)
        {
            if (Form.Controls[i].ID != "" && Form.Controls[i].GetType().Name != "LiteralControl")
            {
                formContorls += Form.Controls[i].ID+"<br/>";
            }
        }
        return formContorls;
    }
}
